home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / misc / zxam16b.lha / ZXAM Spectrum / zxam_rexx / English / SaveScreen.zxam < prev    next >
Encoding:
Text File  |  1994-10-23  |  3.5 KB  |  111 lines

  1. /* this script save the actual Spectrum's screen as IFF */
  2.     
  3.     address command
  4.     
  5.     if ~show(ports,ZXAM_REXX) then do
  6.         requestchoice 'title "ZXAM Script error..." body "I can''t find the emulator''s port!!" gadgets "AARGH!"'
  7.         exit 0
  8.         end
  9.  
  10. /* we use the emulator's filerequester */
  11.     
  12.     cajon=""  /* default path for screens */
  13.     
  14.     oldcajon=zxamactloadpath()    /* store old path */
  15.     oldpattern=zxamactpattern()    /* store old pattern */
  16.     zxampattern('(#?.iff|#?.pic)')  /* new pattern */
  17.     
  18.     nombre=zxamsaverequester('Name to save screen as IFF...',cajon)
  19.     
  20.     zxampattern(oldpattern)        /* retrieve the pattern */
  21.     zxamloadpath(oldcajon)        /* retrieve the path */    
  22.     
  23.     if nombre='' then do
  24.         exit    /* CANCEL */
  25.         end
  26.     
  27. /* open file */
  28.  
  29.     if ~OPEN('fichero',nombre,'Write') then exit 0
  30.     
  31.     oldname=zxamactname()        /* old window status */
  32.     oldformat=zxamactformat()
  33.     
  34.     zxamnameformat('    (SAVING IFF SCREEN)','')
  35.     
  36. /* ID header */
  37.     dummy=writech('fichero','FORM')
  38.     dummy=writech('fichero','000060a8'x)    /* total size */
  39.     dummy=writech('fichero','ILBM')
  40.  
  41. /* chunk ANNO */
  42.     dummy=writech('fichero','ANNO')
  43.     dummy=writech('fichero','00000033'x)    /* size 51 chars */
  44.     dummy=writech('fichero','Saved by ZXAM Spectrum Emulator AGA (by Toni Pomar)')
  45.     dummy=writech('fichero','00'x)        /* pad to align */
  46.  
  47. /* chunk BMHD */
  48.     dummy=writech('fichero','BMHD')
  49.     dummy=writech('fichero','00000014'x)    /* size 20 */
  50.     dummy=writech('fichero','0100'x)    /* width */
  51.     dummy=writech('fichero','00c0'x)    /* height */
  52.     dummy=writech('fichero','0000'x)    /* pos x */
  53.     dummy=writech('fichero','0000'x)    /* pos y */
  54.     dummy=writech('fichero','04'x)        /* nro bitplanes */
  55.     dummy=writech('fichero','00'x)        /* masking */
  56.     dummy=writech('fichero','00'x)        /* compression */
  57.     dummy=writech('fichero','00'x)        /* Pad1 */
  58.     dummy=writech('fichero','0000'x)    /* transparent color */
  59.     dummy=writech('fichero','2c2c'x)    /* aspect 44:44 */
  60.     dummy=writech('fichero','0140'x)    /* width source page (320) */
  61.     dummy=writech('fichero','0100'x)    /* heigth source page (256) */
  62.  
  63. /* chunk CAMG */
  64.     dummy=writech('fichero','CAMG')
  65.     dummy=writech('fichero','00000004'x)    /* size 4 */
  66.     dummy=writech('fichero','00000000'x)    /* 00021000 = PAL:Lo-res */
  67.  
  68. /* chunk CMAP */
  69.  
  70.     dummy=writech('fichero','CMAP')
  71.     dummy=writech('fichero','00000030'x)    /* size 48 (16 colors*3 bytes) */
  72.     
  73.     /* border color */
  74.     /* color 0 to 7 acts as an index to acces to the array */
  75.     dummy=writech('fichero',x2c(substr('000000000099990000990099009900009999999900999999',(zxamgetreg(bor)*6)+1,6)))
  76.     
  77.     dummy=writech('fichero','000099'x)    /* color 1 */
  78.     dummy=writech('fichero','990000'x)    /* color 2 */
  79.     dummy=writech('fichero','990099'x)    /* color 3 */
  80.     dummy=writech('fichero','009900'x)    /* color 4 */
  81.     dummy=writech('fichero','009999'x)    /* color 5 */
  82.     dummy=writech('fichero','999900'x)    /* color 6 */
  83.     dummy=writech('fichero','999999'x)    /* color 7 */
  84.     dummy=writech('fichero','000000'x)    /* color 8 */
  85.     dummy=writech('fichero','0000aa'x)    /* color 9 */
  86.     dummy=writech('fichero','bb0000'x)    /* color 10 */
  87.     dummy=writech('fichero','cc00cc'x)    /* color 11 */
  88.     dummy=writech('fichero','00cc00'x)    /* color 12 */
  89.     dummy=writech('fichero','00dddd'x)    /* color 13 */
  90.     dummy=writech('fichero','eeee00'x)    /* color 14 */
  91.     dummy=writech('fichero','ffffff'x)    /* color 15 */
  92.     
  93.  
  94. /* chunk BODY */
  95.  
  96.     dummy=writech('fichero','BODY')
  97.     dummy=writech('fichero','00006000'x)    /* size 6144*4 (4 bpls of 256*192) */
  98.  
  99. /* we use a special emulator's function to extract and convert to bitplanes */
  100.  
  101.     dummy=writech('fichero',zxamgetscr())
  102.  
  103.     dummy=close('fichero')
  104.     
  105.     if oldname=='' then
  106.         zxamclearnameformat()
  107.     else
  108.         zxamnameformat(oldname,oldformat)
  109.     
  110.     exit
  111.